Imports System.Windows.Forms
Imports dao
 Imports System.Data
Imports DTO
Public Class CTGIANGDAYBus
Inherits AbstractBus
 Public Sub New()
 End Sub
 Public Sub New(ByVal ConnectionString As KetNoiDto)
 ketnoi = ConnectionString
 End Sub
 #Region "Xử Lý" 
 Public Sub Them(ByVal Dto As CTGIANGDAYDto)
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.Them(Dto)
 End Sub
 Public Sub Xoa( ByVal IDCTGIANGDAY As System.Int32)
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.xoa(IDCTGIANGDAY)
 End Sub
 Public Sub sua(ByVal Dto As CTGIANGDAYDto)
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.sua(Dto)
 End Sub
 #End Region 
 Public Function LayBangTable() As DataTable
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 dao.laybang()
 Return Dao
 End Function
 Public Function LayBangTableIlist() As IList
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dim aList As New ArrayList 
 For i As Integer = 0 To Dao.Rows.Count - 1 
 Dim dtoCTGIANGDAY As CTGIANGDAYdto = LayBangDTo(i, Dao) 
 aList.Add(dtoCTGIANGDAY)
 Next 
 Return aList 
 End Function
 Public Function LayBangTableSQL(ByVal sql As string) As DataTable
 Dim Dao As New  AbstractDao(sql,sql,ketnoi)
 Return Dao
 End Function
 Public Sub suaIDGIAOVIEN( ByVal IDGIAOVIEN as System.Int32, ByVal IDCTGIANGDAY As System.Int32 )
 Dim dao As New CTGIANGDAYDao(ketnoi)
 dao.suaIDGIAOVIEN(IDGIAOVIEN,IDCTGIANGDAY)
 End Sub 
 Public Sub suaIDLOPHOC( ByVal IDLOPHOC as System.Int32, ByVal IDCTGIANGDAY As System.Int32 )
 Dim dao As New CTGIANGDAYDao(ketnoi)
 dao.suaIDLOPHOC(IDLOPHOC,IDCTGIANGDAY)
 End Sub 
 Public Sub suaNGAYBATDAU( ByVal NGAYBATDAU as System.DateTime, ByVal IDCTGIANGDAY As System.Int32 )
 Dim dao As New CTGIANGDAYDao(ketnoi)
 dao.suaNGAYBATDAU(NGAYBATDAU,IDCTGIANGDAY)
 End Sub 
 Public Sub suaNGAYKETTHUC( ByVal NGAYKETTHUC as System.DateTime, ByVal IDCTGIANGDAY As System.Int32 )
 Dim dao As New CTGIANGDAYDao(ketnoi)
 dao.suaNGAYKETTHUC(NGAYKETTHUC,IDCTGIANGDAY)
 End Sub 
 Public Sub suaTRANGTHAI( ByVal TRANGTHAI as System.Int32, ByVal IDCTGIANGDAY As System.Int32 )
 Dim dao As New CTGIANGDAYDao(ketnoi)
 dao.suaTRANGTHAI(TRANGTHAI,IDCTGIANGDAY)
 End Sub 
 Public Sub suaGHICHU( ByVal GHICHU as System.String, ByVal IDCTGIANGDAY As System.Int32 )
 Dim dao As New CTGIANGDAYDao(ketnoi)
 dao.suaGHICHU(GHICHU,IDCTGIANGDAY)
 End Sub 
 Public Function LayBangTable( ByVal IDCTGIANGDAY As System.Int32) As DataTable
 Dim Dao As New CTGIANGDAYDao(IDCTGIANGDAY,ketnoi)
 Return Dao
 End Function
 Public Function LayBangTableIlist( ByVal IDCTGIANGDAY As System.Int32) As IList
 Dim Dao As New CTGIANGDAYDao(IDCTGIANGDAY,ketnoi)
 Dim aList As New ArrayList 
 For i As Integer = 0 To Dao.Rows.Count - 1 
 Dim dtoCTGIANGDAY As CTGIANGDAYdto = LayBangDTo(i, Dao) 
 aList.Add(dtoCTGIANGDAY)
 Next 
 Return aList 
 End Function
 Public Function LayBangTableTheoIDCTGIANGDAY (ByVal IDCTGIANGDAY As System.Int32) As DataTable
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.layBangTheoIDCTGIANGDAY(IDCTGIANGDAY)
 Return Dao
 End Function
 Public Function LayBangTableTheoIDCTGIANGDAY (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.layBangTheoIDCTGIANGDAY(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoIDCTGIANGDAY (ByVal IDCTGIANGDAY As System.Int32) 
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.XOABangTheoIDCTGIANGDAY(IDCTGIANGDAY)
 End sub
 Public Function LayBangTableTheoIDGIAOVIEN (ByVal IDGIAOVIEN As System.Int32) As DataTable
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.layBangTheoIDGIAOVIEN(IDGIAOVIEN)
 Return Dao
 End Function
 Public Function LayBangTableTheoIDGIAOVIEN (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.layBangTheoIDGIAOVIEN(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoIDGIAOVIEN (ByVal IDGIAOVIEN As System.Int32) 
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.XOABangTheoIDGIAOVIEN(IDGIAOVIEN)
 End sub
 Public Function LayBangTableTheoIDLOPHOC (ByVal IDLOPHOC As System.Int32) As DataTable
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.layBangTheoIDLOPHOC(IDLOPHOC)
 Return Dao
 End Function
 Public Function LayBangTableTheoIDLOPHOC (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.layBangTheoIDLOPHOC(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoIDLOPHOC (ByVal IDLOPHOC As System.Int32) 
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.XOABangTheoIDLOPHOC(IDLOPHOC)
 End sub
 Public Function LayBangTableTheoNGAYBATDAU (ByVal NGAYBATDAU As System.DateTime) As DataTable
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.layBangTheoNGAYBATDAU(NGAYBATDAU)
 Return Dao
 End Function
 Public Function LayBangTableTheoNGAYBATDAU(ByVal NGAYBATDAU1 As System.DateTime,ByVal NGAYBATDAU2 As System.DateTime ) As DataTable
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.layBangTheoNGAYBATDAU(NGAYBATDAU1 ,NGAYBATDAU2)
 Return Dao
 End Function
 Public Function LayBangTableTheoNGAYBATDAU (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.layBangTheoNGAYBATDAU(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoNGAYBATDAU (ByVal NGAYBATDAU As System.DateTime) 
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.XOABangTheoNGAYBATDAU(NGAYBATDAU)
 End sub
 Public Function LayBangTableTheoNGAYKETTHUC (ByVal NGAYKETTHUC As System.DateTime) As DataTable
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.layBangTheoNGAYKETTHUC(NGAYKETTHUC)
 Return Dao
 End Function
 Public Function LayBangTableTheoNGAYKETTHUC(ByVal NGAYKETTHUC1 As System.DateTime,ByVal NGAYKETTHUC2 As System.DateTime ) As DataTable
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.layBangTheoNGAYKETTHUC(NGAYKETTHUC1 ,NGAYKETTHUC2)
 Return Dao
 End Function
 Public Function LayBangTableTheoNGAYKETTHUC (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.layBangTheoNGAYKETTHUC(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoNGAYKETTHUC (ByVal NGAYKETTHUC As System.DateTime) 
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.XOABangTheoNGAYKETTHUC(NGAYKETTHUC)
 End sub
 Public Function LayBangTableTheoTRANGTHAI (ByVal TRANGTHAI As System.Int32) As DataTable
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.layBangTheoTRANGTHAI(TRANGTHAI)
 Return Dao
 End Function
 Public Function LayBangTableTheoTRANGTHAI (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.layBangTheoTRANGTHAI(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoTRANGTHAI (ByVal TRANGTHAI As System.Int32) 
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.XOABangTheoTRANGTHAI(TRANGTHAI)
 End sub
 Public Function LayBangTableTheoGHICHU (ByVal GHICHU As System.String) As DataTable
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.layBangTheoGHICHU(GHICHU)
 Return Dao
 End Function
 Public Function LayBangTableTheoGHICHU_like (ByVal GHICHU As System.String ) As DataTable
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.layBangTheoGHICHU_like (GHICHU)
 Return Dao
 End Function
 Public Function LayBangTableTheoGHICHU (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.layBangTheoGHICHU(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoGHICHU (ByVal GHICHU As System.String) 
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.XOABangTheoGHICHU(GHICHU)
 End sub
 Public Function LayBangDTo( ByVal IDCTGIANGDAY As System.Int32) As CTGIANGDAYdto
 Dim Dao As New CTGIANGDAYDao(IDCTGIANGDAY, ketnoi)
 Dim dto As New CTGIANGDAYdto
 If Dao.Rows.Count<= 0 then Return dto
 Try
 If IsDBNull(Dao.Rows(0)("IDCTGIANGDAY")) = False Then
 Dto.IDCTGIANGDAY = Dao.Rows(0)("IDCTGIANGDAY")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("CTGIANGDAY.IDCTGIANGDAY")) = False Then
 Dto.IDCTGIANGDAY = Dao.Rows(0)("CTGIANGDAY.IDCTGIANGDAY")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("IDGIAOVIEN")) = False Then
 Dto.IDGIAOVIEN = Dao.Rows(0)("IDGIAOVIEN")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("CTGIANGDAY.IDGIAOVIEN")) = False Then
 Dto.IDGIAOVIEN = Dao.Rows(0)("CTGIANGDAY.IDGIAOVIEN")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("IDLOPHOC")) = False Then
 Dto.IDLOPHOC = Dao.Rows(0)("IDLOPHOC")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("CTGIANGDAY.IDLOPHOC")) = False Then
 Dto.IDLOPHOC = Dao.Rows(0)("CTGIANGDAY.IDLOPHOC")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("NGAYBATDAU")) = False Then
 Dto.NGAYBATDAU = Dao.Rows(0)("NGAYBATDAU")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("CTGIANGDAY.NGAYBATDAU")) = False Then
 Dto.NGAYBATDAU = Dao.Rows(0)("CTGIANGDAY.NGAYBATDAU")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("NGAYKETTHUC")) = False Then
 Dto.NGAYKETTHUC = Dao.Rows(0)("NGAYKETTHUC")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("CTGIANGDAY.NGAYKETTHUC")) = False Then
 Dto.NGAYKETTHUC = Dao.Rows(0)("CTGIANGDAY.NGAYKETTHUC")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("TRANGTHAI")) = False Then
 Dto.TRANGTHAI = Dao.Rows(0)("TRANGTHAI")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("CTGIANGDAY.TRANGTHAI")) = False Then
 Dto.TRANGTHAI = Dao.Rows(0)("CTGIANGDAY.TRANGTHAI")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("GHICHU")) = False Then
 Dto.GHICHU = Dao.Rows(0)("GHICHU")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("CTGIANGDAY.GHICHU")) = False Then
 Dto.GHICHU = Dao.Rows(0)("CTGIANGDAY.GHICHU")
 End if
Catch ex As Exception
End Try
 Return dto
 end function
 Public Function LayBangDTo(ByVal i As Integer, ByVal dao As DataTable) As CTGIANGDAYdto
 Dim dto As New CTGIANGDAYdto
 If Dao.Rows.Count<=0 then Return dto
 Try
 If IsDBNull(Dao.Rows(i)("IDCTGIANGDAY")) = False Then
 Dto.IDCTGIANGDAY = Dao.Rows(i)("IDCTGIANGDAY")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("CTGIANGDAY.IDCTGIANGDAY")) = False Then
 Dto.IDCTGIANGDAY = Dao.Rows(i)("CTGIANGDAY.IDCTGIANGDAY")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("IDGIAOVIEN")) = False Then
 Dto.IDGIAOVIEN = Dao.Rows(i)("IDGIAOVIEN")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("CTGIANGDAY.IDGIAOVIEN")) = False Then
 Dto.IDGIAOVIEN = Dao.Rows(i)("CTGIANGDAY.IDGIAOVIEN")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("IDLOPHOC")) = False Then
 Dto.IDLOPHOC = Dao.Rows(i)("IDLOPHOC")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("CTGIANGDAY.IDLOPHOC")) = False Then
 Dto.IDLOPHOC = Dao.Rows(i)("CTGIANGDAY.IDLOPHOC")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("NGAYBATDAU")) = False Then
 Dto.NGAYBATDAU = Dao.Rows(i)("NGAYBATDAU")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("CTGIANGDAY.NGAYBATDAU")) = False Then
 Dto.NGAYBATDAU = Dao.Rows(i)("CTGIANGDAY.NGAYBATDAU")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("NGAYKETTHUC")) = False Then
 Dto.NGAYKETTHUC = Dao.Rows(i)("NGAYKETTHUC")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("CTGIANGDAY.NGAYKETTHUC")) = False Then
 Dto.NGAYKETTHUC = Dao.Rows(i)("CTGIANGDAY.NGAYKETTHUC")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("TRANGTHAI")) = False Then
 Dto.TRANGTHAI = Dao.Rows(i)("TRANGTHAI")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("CTGIANGDAY.TRANGTHAI")) = False Then
 Dto.TRANGTHAI = Dao.Rows(i)("CTGIANGDAY.TRANGTHAI")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("GHICHU")) = False Then
 Dto.GHICHU = Dao.Rows(i)("GHICHU")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("CTGIANGDAY.GHICHU")) = False Then
 Dto.GHICHU = Dao.Rows(i)("CTGIANGDAY.GHICHU")
 End if
 Catch ex As Exception
 End Try
 Return dto
 end function
 Public Function LayBangDTo(ByVal dong As Integer, ByVal dao As DataGridView) As CTGIANGDAYdto
 Dim dto As New CTGIANGDAYdto
 If dao.Rows.Count <= 0 Then Return dto
 For cot As Integer = 0 To dao.Columns.Count - 1
 Try
 Dto.HoTro(dao.Columns(cot).DataPropertyName, dao.Item(cot, dong).Value)
 Catch ex As Exception
 End Try
 Next
 Return Dto
 End Function
 Public Function layBangNhieuTable() as Datatable
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.layBangNhieuTable()
 Return Dao
 End Function
 Public Sub Taotable()
 Dim Dao As New CTGIANGDAYDao(ketnoi)
 Dao.TaoTable()
 End Sub
 End Class

